package com.atguigu.boot.controller;


import com.atguigu.boot.bean.Car;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Import;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.concurrent.TimeUnit;

//@ResponseBody
//@Controller





// JRebel
@Slf4j
@RestController
public class HelloController {

    @Value("${user}")
    private String user;

    @RequestMapping("/hello")
    public String handle01(@RequestParam("name") String name){


        log.info("{} 请求马上进了....", user);
        if(!name.equalsIgnoreCase("admin")) {
            try {
                TimeUnit.SECONDS.sleep(60);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        return "Hello, Spring Boot 2!"+"你好："+name;
    }

    @Autowired
    Car car;


    @RequestMapping("/car")
    public Car car(){
        return car;
    }



}
